function init (config) {
  return {
    getTeamAndPlayers() {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      console.log(url)
      return fetch(url, {
        method: 'POST',
        body: `{"source":{},"token":"${Cookies.get('token')}","type":5500}`
      });
    },
    wxWidthDraw(money) {
      const url = `${config.pre}/withdrawals/Apply/${Cookies.get('areaCode')}/${money}`;
      return fetch(url, {
        method: 'POST',
        headers: {
          Authorization: Cookies.get('token'),
          'Content-type': 'application/json'
        }
      });
    },
    editPassword(send) {
      const url = `${config.pre}/agent/upPass/`;
      return fetch(url, {
        method: 'POST',
        headers: {
          Authorization: Cookies.get('token'),
          'Content-type': 'application/json'
        },
        body: JSON.stringify(send)
      });
    },
    getNoticeData(params) {
      console.log(params)
      const url = `${config.pre}/agent/${Cookies.get('areaCode')}/notice`
      return fetch(url, {
        method: 'GET',
        headers: {
          Authorization: Cookies.get('token'),
          'Content-type': 'application/json'
        }
      });
    },
    getShow(params) {
      console.log(params)
      const url = `${config.pre}agent/${Cookies.get('areaCode')}/ascend?limit=${params.limit}&offset=${params.offset}`
      // const opt = {
      //   method: 'GET',
      //   headers: {
      //     Authorization: Cookies.get('token'),
      //     'Content-type': 'application/json'
      //   }
      // }
      // return fetch(url, opt)
      return fetch(url, {
        method: 'GET',
        headers: {
          Authorization: Cookies.get('token'),
          'Content-type': 'application/json'
        }
      });
    },
    queryTopupId(params) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      console.log(`{"source":{},"token":"${Cookies.get('token')}","type":5517}`)
      return fetch(url, {
        method: 'POST',
        body: `{"source":{"lftid":"${params.lftid}"},"token":"${Cookies.get('token')}","type":5517,"lftid":${params.lftid}}`
      });
    },
    confirmTopup(params) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      return fetch(url, {
        method: 'POST',
        body: `{"source":{"uid":"${params.uid}","number": "${params.number}"},"token":"${Cookies.get('token')}","type":5518}`
      });
    },
    queryTopupRecord(params) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      return fetch(url, {
        method: 'POST',
        body: `{"source":{"limit":"${params.limit}","offset": "${params.offset}","fromTime": "${params.fromTime}","toTime": "${params.toTime}"},"token":"${Cookies.get('token')}","type":5519}`
      });
    },
    queryInfo(send) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      const queryObj = {
        source: send,
        token: Cookies.get('token'),
        type: 5520
      }
      console.log('queryInfo', JSON.stringify(queryObj));
      return fetch(url, {
        method: 'POST',
        body: JSON.stringify(queryObj)
      });
    },
    editInfo(send) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      const queryObj = {
        source: send,
        token: Cookies.get('token'),
        type: 5521
      }
      console.log('editInfo', JSON.stringify(queryObj));
      return fetch(url, {
        method: 'POST',
        body: JSON.stringify(queryObj)
      });
    },
    getIdCard(send) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      const queryObj = {
        source: send,
        token: Cookies.get('token'),
        type: 5522
      }
      console.log('getIdCard', JSON.stringify(queryObj));
      
      return fetch(url, {
        method: 'POST',
        body: JSON.stringify(queryObj)
      });
    },
    uploadIdCard(send) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      const queryObj = {
        source: send,
        token: Cookies.get('token'),
        type: 5523
      }
      return fetch(url, {
        method: 'POST',
        body: JSON.stringify(queryObj)
      });
    },
    getMallUrl(send) {
      const url = `${config.pre}/personalCenter/${Cookies.get('areaCode')}`
      return fetch(url, {
        method: 'GET',
        headers: {
          Authorization: Cookies.get('token'),
          'Content-type': 'application/json'
        }
      });
    },
    getRankingList(send) {
      const url = `${config.agentSystem}${Cookies.get('areaCode')}`;
      const queryObj = {
        source: send,
        token: Cookies.get('token'),
        type: 5525
      }
      return fetch(url, {
        method: 'POST',
        body: JSON.stringify(queryObj)
      });
    },
  }
}

export default init